const { defineConfig } = require('@vue/cli-service')
const {list}=require('./src/mock')
module.exports = defineConfig({
  transpileDependencies: true,
  // 自行模拟数据 mock +devServer
  devServer:{
    setupMiddlewares(middlewares,{app}){
      app.get('/api/list',(req,res)=>{
        res.send({
          list
        })
      })
      app.get('/api/item',(req,res)=>{
        const {id}=req.query
        const item=list.find(v=>v.id===id)
        res.send({
          list:item
        })
      })
      return middlewares
    }
  }
})
